/**
 * @file rank/popularize/luogu1007/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/7 17:09:12
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int N = 5e3 + 10;
int Left[N], Right[N];
int l, n;
int main() {
  // High rating and good luck!
  cin >> l >> n;
  for (int i = 0; i < n; ++i) {
    cin >> Left[i];
    Right[i] = l + 1 - Left[i];
  }
  int mn = 0, mx = 0;
  for (int i = 0; i < n; ++i) {
    mn = max(mn, min(Left[i], Right[i]));
    mx = max(mx, max(Left[i], Right[i]));
  }
  cout << mn << ' ' << mx << endl;
  return 0;
}
